package com.zhentao.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.entity.user.UserAddress;
import com.zhentao.service.UserAddressService;
import com.zhentao.mapper.UserAddressMapper;
import com.zhentao.utils.AuthContextUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Lenovo
* @description 针对表【user_address(用户地址表)】的数据库操作Service实现
* @createDate 2024-09-05 16:20:12
*/
@Service
public class UserAddressServiceImpl extends ServiceImpl<UserAddressMapper, UserAddress>
    implements UserAddressService{

    @Resource
    private UserAddressMapper userAddressMapper;
    /**
     *获取用户地址列表
     * @return
     */
    @Override
    public List<UserAddress> findUserAddressList() {
        Long userId = AuthContextUtil.getUserInfo().getId();
        return userAddressMapper.selectList(Wrappers.<UserAddress>lambdaQuery().eq(UserAddress::getUserId,userId));
    }
}




